//**************************************************
//	Digit Widgets Stroke Module
// 	Stroke Manipulation Control
//	Made to be called from Hyperlinked Digit_Widgets Script
//
// Version 3.0 - 09/12/01 - Added Animation Script to Widgets
//	Version 3.1 - 09/15/01 - Updated with Advanced and Standard Animation Scripts
//**************************************************
<zscriptinsert,"Digit_Widgets_Common.txt">
//****************************
// Stroke Definitions
//****************************
[VarDef,maxAvailableStrokes,10] 
[varDef,strokesList(maxAvailableStrokes+1)]  
[varDef,multistrokesList(maxAvailableStrokes+1)]
[varDef,theStroke,0]
[varDef,theStrokes,0]
[VarDef,currlen,0]
[varDef,currfile,1]
[varDef,currmultifile,1]
[VarDef,fil]
[varDef,PosX,0]
[varDef,PosY,0]
[VarDef,originalH,0]
[VarDef,originalV,0]
[varDef,rot,90]
[varDef,scal,1]
[varDef,hoff,0]
[varDef,voff,0]
[varDef,turns,0]
[VarDef,tempcounter,0]
[VarDef,numpts,0]
[VarDef,ox,0]
[VarDef,oy,0]
[VarDef,ex,0]
[VarDef,ey,0]
[VarDef,XD1,0]
[VarDef,YD1,0]
[VarDef,ZD1,0]
[VarDef,ypt,0]
[VarDef,xpt,0]
[VarDef,zpt,0]

[PD]
//***************************************************
[PD]
[iSlider,"OriginX  ",0,1,0,DocWidth,"Place Origin X",[varSet,PosX,zscript:OriginX],0,[TextCalcWidth,Distance1453]]
[iSlider,"OriginY  ",0,1,0,DocHeight,"PlaceOrigin Y",[varSet,PosY,zscript:OriginY],0,[TextCalcWidth,Distance1453]]

//***************************************************
//Use Marker it is neccesary script merged with Marker Routines
//***************************************************
[iSwitch,"UseCurrentMark",1,"Use Current Position Marker"] 
[IButton,"Place Stroke","Place Stroke then erase if necessary",
	[VarSet,theStroke,[StrokeGetLast]] //get the last drawn stroke
	// we now want the stroke to be drawn at PosX,PosY regardless of it original position
	// to do so, we interogate the stroke data and get its start position
	// then we can add the appropriate offset in order to have drawn at 100,100
	[VarSet,originalH,[StrokeGetInfo,theStroke,1,0]] // get start H position
	[VarSet,originalV,[StrokeGetInfo,theStroke,2,0]] // get start V position
	// now  we draw the stroke with rotation=0, scaling=1, and calculated delta offset.
	[if,[iGet,zscript:UseCurrentMark],
		[CanvasStroke,theStroke,0,0,1,1,MarkX(MarkIndex)-originalH,MarkY(MarkIndex)-originalV]
	, //else
		[CanvasStroke,theStroke,0,0,1,1,PosX-originalH,PosY-originalV]
	]//endif
]//end place stroke
[PD]
//**************************************************************************
//****************Do Single Stroke Select recorded or lastStroke************
//**************************************************************************
[iSlider,"Rotateit",90,1,0,360,"Rotate Degrees", 	[varSet,rot,zscript:Rotateit],0,[TextCalcWidth,Distance1453]]
[iSlider,"Scaleit",1,.1,1,10,"Scale Sroke",		[varSet,scal,zscript:Scaleit],0,[TextCalcWidth,Distance1453]]
[iSlider,"OffsetH",0,1,-500,500,"Offset Horiz",	[varSet,hoff,zscript:OffsetH],0,[TextCalcWidth,Distance1453]]
[iSlider,"OffsetV",0,1,-500,500,"Offset Vert",	[varSet,voff,zscript:OffsetV],0,[TextCalcWidth,Distance1453]]
[iSwitch,"Circle",1,"Complete a 360 circle"] 
[iSwitch,"UseStrokes",1,"Use Stroke File"] 
[iSlider,"LengthS  ",0,1,-500,500,"Radius of Stroke",[varSet,currlen,zscript:LengthS]]

[iButton," LastStroke ","Repeat last Brush Stroke",
	[varSet,turns,1]
	[if,[iGet,zscript:Circle],
		[varSet,turns,360/rot]
	] //endif
	//not sure why tempCounter here but Pixolator wrote the usestrokes one
	[VarSet,tempCounter,1]

	[loop,turns,
		[if,[iGet,zscript:UseStrokes], 
			[CanvasStroke,strokesList(currfile),0,rot*tempCounter,scal,scal,hoff*tempCounter/turns,voff*tempCounter/turns]
			[VarInc,tempCounter]
		,//else
			[CanvasStroke,[StrokeGetLast],0,rot,scal,scal,hoff*tempCounter/turns,voff*tempCounter/turns]
		] // endif

	] //end loop
	[varSet,currlen,[StrokeGetInfo,[StrokeGetLast],8]]
	[ISet,zscript:LengthS,currlen]
]//end LastStroke
[iButton," ColorLastStroke ","Repeat last Brush Stroke",
	[varSet,turns,1]
	[if,[iGet,zscript:Circle],
		[varSet,turns,360/rot]
	] //endif
	//not sure why tempCounter here but Pixolator wrote the usestrokes one
	[VarSet,tempCounter,1]
	[VarSet,theStroke,[StrokeGetLast]] //get the last drawn stroke
	[VarSet,numpts,[StrokeGetInfo,theStroke,0]]
	//get xy of origin
	[VarSet,ox,[StrokeGetInfo,theStroke,1,0]]
	[VarSet,oy,[StrokeGetInfo,theStroke,2,0]]
	[RoutineCall,ZcolorCalc,ox,oy,0]
	//get length
	[loop,turns,
			
		[CanvasStroke,[StrokeGetLast],0,rot,scal,scal,hoff*tempCounter/turns,voff*tempCounter/turns]
		[VarSet,ex,[StrokeGetInfo,[StrokeGetLast],1,numpts]]
		[VarSet,ey,[StrokeGetInfo,[StrokeGetLast],2,numpts]]
		[RoutineCall,ZcolorCalc,ex,ey,0]

	] //end loop
	[varSet,currlen,[StrokeGetInfo,[StrokeGetLast],8]]
	[ISet,zscript:LengthS,currlen]
]//end LastStroke

//**************************************************************************
//****************Do Multi Stroke ************
//**************************************************************************
[PD]
[FontSetColor,255,200,0]Multi Stroke Utility[FontSetColor,160,160,160]
[PD]
[PD]
[iSlider,"MultiRotateit",90,1,0,360,"Rotate Degrees", 	[varSet,rot,zscript:MultiRotateit],0,[TextCalcWidth,Distance1453]]
[iSlider,"MultiScaleit",1,.1,1,10,"Scale Sroke",	[varSet,scal,zscript:MultiScaleit],0,[TextCalcWidth,Distance1453]]
[iSlider,"MultiOffsetH",0,1,-500,500,"Offset Horiz",	[varSet,hoff,zscript:MultiOffsetH],0,[TextCalcWidth,Distance1453]]
[iSlider,"MultiOffsetV",0,1,-500,500,"Offset Vert",	[varSet,voff,zscript:MultiOffsetV],0,[TextCalcWidth,Distance1453]]
[iSwitch,"MultiCircle",1,"Complete a 360 circle"] 

[iButton," MultiLastStroke ","Repeat last Brush Strokes",
	[varSet,turns,1]
	[if,[iGet,zscript:MultiCircle],
		[varSet,turns,360/rot]
	] //endif
	//not sure why tempCounter here but Pixolator wrote the usestrokes one
	[VarSet,tempCounter,1]

	[loop,turns,
			[CanvasStrokes,multistrokesList(currmultifile),0,rot*tempCounter,scal,scal,hoff*tempCounter/turns,voff*tempCounter/turns]
			[VarInc,tempCounter]

	] //end loop
]//end MultiLastStroke
//**************************************************************************
//**********************Select Strokefile Number*****************************
//**************************************************************************
[PD]
[FontSetColor,255,200,0]Load Strokes[FontSetColor,160,160,160]

[iSlider,"Filenumber ",1,1,1,10,"Select a Single Strokefile",
	[varSet,currfile,zscript:Filenumber]
	[varSet,fil,[FileNameMake,"stroke.txt",currfile,1]]
	[VarSet,strokesList(currfile),[StrokeLoad,fil]],
	0,[TextCalcWidth,Filenumberxxx]  
]
[iSlider,"FilenumberMulti ",1,1,1,10,"Select a Multiple Strokefile",
	[varSet,currmultifile,zscript:FilenumberMulti]
	[varSet,fil,[FileNameMake,"strokes.txt",currmultifile,1]]
	[VarSet,multistrokesList(currmultifile),[StrokesLoad,fil]],
	0,[TextCalcWidth,FilenumberMultixxx]  
]
[PD]
[PD]
<zscriptinsert,"Widgets_Index_Include.txt">
[PD]
[PD]
[fontSetSizeSmall]\C00e0e0Digit Widget Stroke Revision 3.3, created by Digits\Cc0c0c0
